package org.jingouzhui.domain.strategy.repository;

import org.jingouzhui.domain.strategy.model.entity.StrategyAwardEntity;
import org.jingouzhui.domain.strategy.model.entity.StrategyEntity;
import org.jingouzhui.domain.strategy.model.entity.StrategyRuleEntity;
import org.jingouzhui.domain.strategy.model.valboj.RuleTreeVO;
import org.jingouzhui.domain.strategy.model.valboj.StrategyAwardRuleModelVO;
import org.jingouzhui.domain.strategy.model.valboj.StrategyAwardStockKeyVO;

import java.util.List;
import java.util.Map;

/**
 * @description: 策略仓储层
 * @author: jingouzhui
 * @date: 2025/4/24 14:36
 */
public interface IStrategyRepository {


    List<StrategyAwardEntity> queryStrategyAwardList(Long strategyId);

    void storeStrategyAwardSearchRateTables(String strategyId, Integer totalRange, Map<Integer, Integer> shuffleStrategyAwardSearchRateMap);

    Integer getRateRange(Long strategyId);

    Integer getRateRange(String strategyId);

    Integer getStrategyAwardAssemble(String key, int rateKey);

    StrategyEntity queryStrategyByStrategyId(Long strategyId);

    StrategyRuleEntity queryStrategyRule(Long strategyId, String ruleModel);

    String queryStrategyRuleValue(Long strategyId, Integer awardId, String ruleModel);

    String queryStrategyRuleValue(Long strategyId, String ruleModel);

    StrategyAwardRuleModelVO queryRuleModelByStrategyIdAndAwardId(Long strategyId, Integer awardId);

    RuleTreeVO queryRuleTreeVOByTreeId(String treeId);

    void storeAwardStockCount(String cacheKey, Long awardCountSurplus);

    Boolean subtractionAwardStock(String cacheKey);

    void awardStockConsumeSendQueue(StrategyAwardStockKeyVO strategyAwardStockKeyVO);

    /**
     * 获取奖品库存消费队列
     */
    StrategyAwardStockKeyVO takeQueueValue() throws InterruptedException;

    void updateStrategyAwardStock(Long strategyId, Integer awardId);

}
